import request from '@/utils/request'
import { method } from 'lodash'

// 被测用户列表
export function testeeList(data) {
  return request({
    url: '/assess/userInfo/selectTestedAll',
    method: 'post',
    data
  })
}

// 其他用户列表
export function otherList(data) {
  return request({
    url: '/assess/userInfo/selectOtherAll',
    method: 'post',
    data
  })
}

// 添加被测人员
export function testeeAdd(data) {
  return request({
    url: '/assess/userInfo/insertTested',
    method: 'post',
    data
  })
}

// 添加其他人员
export function otherAdd(data) {
  return request({
    url: '/assess/userInfo/insertOther',
    method: 'post',
    data
  })
}


// 修改被测人员
export function testeeUpdate(data) {
  return request({
    url: '/assess/userInfo/update',
    method: 'post',
    data
  })
}

// 删除用户
export function userDelete(data) {
  return request({
    url: '/assess/userInfo/delete',
    method: 'post',
    data
  })
}

// 获取所有角色信息
export function getRole(data) {
  return request({
    url: '/assess/roleInfo/selectAll',
    method: 'post',
    data
  })
}

// 获取可用角色信息
export function getCanRole(data) {
  return request({
    url: '/assess/roleInfo/selectStatusAll',
    method: 'post',
    data
  })
}

// 添加角色信息
export function addRole(data) {
  return request({
    url: '/assess/roleInfo/insert',
    method: 'post',
    data
  })
}

// 修改角色信息
export function updateRole(data) {
  return request({
    url: '/assess/roleInfo/update',
    method: 'post',
    data
  })
}

// 删除角色信息
export function deleteRole(data) {
  return request({
    url: '/assess/roleInfo/delete',
    method: 'post',
    data
  })
}

// 获取用户路由
export function getUserRole() {
  return request({
    url: '/assess/roleInfo/selectTreeRouteConfig',
    method: 'get'
  })
}

// 获取所有路由
export function getAllRouter() {
  return request({
    url: '/assess/roleInfo/selectTreeAllCatalogue',
    method: 'get'
  })
}

// 获取用户个人信息
export function getUserInfo() {
  return request({
    url: '/system/user/profile/profileDev',
    method: 'get'
  })
}

// 根据角色id获取权限
export function getRoutesByRoleId(roleId) {
  return request({
    url: `/assess/roleInfo/selectRouteIdsByRoleId/${roleId}`,
    method: 'get'
  })
}

// 头像上传
export function uploadAvatar(data) {
  return request({
    url: '/system/user/profile/avatar',
    method: 'post',
    data
  })
}

// 重置密码
export function resetPassword(data) {
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'post',
    data
  })
}

// 获取用户配置信息
export function getConfig() {
  return request({
    url: '/system/userConfig/getConfig',
    method: 'get'
  })
}

// 修改用户配置星系
export function updateConfig(data) {
  return request({
    url: '/system/userConfig/update',
    method: 'post',
    data
  })
}